# 导包
import torch


#手动准备真实值
# todo 使用热编码方式
y_true = torch.tensor([0,1,0],dtype=torch.float)
# 准备预测值(开启自动微分)
y_pred = torch.tensor([0.1,0.7,0.2],dtype=torch.float)

criterion = torch.nn.BCELoss()

bce_loss = criterion(y_pred, y_true)
print(bce_loss)
